package smedi.ismedi.web.bff.dto;

import com.smedi.ismedi.personnel.api.dto.response.InternalAssignmentResponse;
import com.smedi.ismedi.personnel.api.dto.response.ProjectAssignmentResponse;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-6-8 13:28
 */
@Data
public class PersonWithCurrentProjectJobResponse implements Serializable {
    @ApiModelProperty(value = "人员id")
    private Long personId;

    @ApiModelProperty(value = "姓名")
    private String lastName;

    @ApiModelProperty(value = "性别")
    private String gender;

    @ApiModelProperty(value = "性别含义")
    private String genderMeaning;

    @ApiModelProperty(value = "人员类型")
    private String personType;

    @ApiModelProperty(value = "人员类型含义")
    private String personTypeMeaning;

    @ApiModelProperty(value = "员工号")
    private String employeeNum;

    @ApiModelProperty(value = "手机号")
    private String mobile;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "身份证")
    private String idCard;

    @ApiModelProperty(value = "座机电话")
    private String officeTelephone;

    @ApiModelProperty(value = "分配id")
    private Long assignmentId;

    @ApiModelProperty(value = "组织id")
    private Long organizationId;

    @ApiModelProperty(value = "从事职务")
    private String jobName;

    @ApiModelProperty(value = "头像id")
    private String imageUUID;

    @ApiModelProperty(value = "签章id")
    private String signatureUUID;

    @ApiModelProperty(value = "用户名")
    private String userName;

    @ApiModelProperty(value = "状态")
    private String status;

    @ApiModelProperty(value = "状态含义")
    private String statusMeaning;

    @ApiModelProperty(value = "是否内部员工")
    private boolean internal;

    @ApiModelProperty(value = "当前项目的职务")
    private String currentProjectJob;

    @ApiModelProperty(value = "企业分配")
    private List<InternalAssignmentResponse> internalAssignments = new ArrayList<>();

    @ApiModelProperty(value = "项目分配")
    private List<ProjectAssignmentResponse> projectAssignments = new ArrayList<>();

    public void setIdCard(String idCard) {
        // 返回前端脱敏处理
        String idCardText = idCard;
        if (!StringUtils.isEmpty(idCard)) {
            idCardText = idCard.substring(0, idCardText.length()-6) + "******";
        }
        this.idCard = idCardText;
    }
}
